import fpga_generation.java_base.*;
import fpga_generation.altera_nios.*;
import fpga_generation.altera_onchip_memory.*;

class example_project extends base_project
{
	public example_project(String name, int impl)
	{
		super(name, impl);
	}

	public void populateSystem() 
	{
		base_clock_source clockSource           = new base_clock_source("system_clock", "clk", 50000000);
		register(clockSource);		
		setAsStandardClock(clockSource);
		
		nios cpu 					= new nios("cpu_0", nios.SIZE_SMALL);
		onchip_memory programMemory = new onchip_memory("onchip_memory2_0", 40*1024);		
		
		register(cpu);
		register(programMemory);
		
		cpu.connectInstructionMaster(programMemory, 0);
		cpu.connectDataMaster(programMemory, 0);
		
		cpu.setExceptionVector(programMemory, 0x20);
		cpu.setResetVector(programMemory, 0x00);
	}
	
	public static void main(String[] args)
	{
		example_project e = new example_project("MyExampleProject", base_project.IMPL_TARGET_ALTERA_SOPC);
		e.setDeviceAndFamily("EP4CE10E22C7", "Cyclone IV E");
		e.populateSystem();
		e.writeResult();
	 }
	
}